//
//  MainTabBarController.m
//  fastwatch
//
//  Created by lanou3g on 15/10/30.
//  Copyright (c) 2015年 songhaowen. All rights reserved.
//

#import "MainTabBarController.h"
#import "CategoryController.h"
#import "SearchController.h"
#import "UserController.h"
//#import "HomeController.h"
#import "HomeNC.h"
#import "mainVC.h"

@interface MainTabBarController ()

@end

@implementation MainTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    NSLog(@"");
    
    // 设置首页
//    HomeController *homeVC = [[HomeController alloc] init];
//    UINavigationController *homeNC = [[UINavigationController alloc] initWithRootViewController:homeVC];
    mainVC *HomeNCmainVC = [[mainVC alloc] init];
    HomeNC *homeNC = [[HomeNC alloc] initWithRootViewController:HomeNCmainVC];
    homeNC.tabBarItem.title = @"首页";
    homeNC.tabBarItem.image = [UIImage imageNamed:@"tabbar_home_normal"];
    // 取消系统 tabBarItem 自带的蓝色
    homeNC.tabBarItem.selectedImage = [[UIImage imageNamed:@"tabbar_home_highlighted"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    // 给 tabBarItem 文字设置颜色
    NSMutableDictionary *homeTextDict = [NSMutableDictionary dictionary];
    homeTextDict[NSForegroundColorAttributeName] = [UIColor orangeColor];
    [homeNC.tabBarItem setTitleTextAttributes:homeTextDict forState:UIControlStateSelected];
    
    
    // 设置分类
    CategoryController *categoryVC = [[CategoryController alloc] init];
    UINavigationController *categoryNC = [[UINavigationController alloc] initWithRootViewController:categoryVC];
    categoryVC.tabBarItem.title = @"分类";
    categoryVC.tabBarItem.image = [UIImage imageNamed:@"tabbar_category_normal"];
    // 取消系统 tabBarItem 自带的蓝色
    categoryVC.tabBarItem.selectedImage = [[UIImage imageNamed:@"tabbar_category_highlighted"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    // 给 tabBarItem 文字设置颜色
    NSMutableDictionary *categoryTextDict = [NSMutableDictionary dictionary];
    categoryTextDict[NSForegroundColorAttributeName] = [UIColor orangeColor];
    [categoryVC.tabBarItem setTitleTextAttributes:categoryTextDict forState:UIControlStateSelected];
    
    
    // 设置搜索
    SearchController *searchVC = [[SearchController alloc] init];
    UINavigationController *searchNC = [[UINavigationController alloc] initWithRootViewController:searchVC];
    searchVC.tabBarItem.title = @"搜索";
    searchVC.tabBarItem.image = [UIImage imageNamed:@"tabbar_search_normal"];
    // 取消系统 tabBarItem 自带的蓝色
    searchVC.tabBarItem.selectedImage = [[UIImage imageNamed:@"tabbar_search_highlighted"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    // 给 tabBarItem 文字设置颜色
    NSMutableDictionary *searchTextDict = [NSMutableDictionary dictionary];
    searchTextDict[NSForegroundColorAttributeName] = [UIColor orangeColor];
    [searchVC.tabBarItem setTitleTextAttributes:searchTextDict forState:UIControlStateSelected];
    
    
    // 设置用户
    UserController *userVC = [[UserController alloc] init];
    UINavigationController *userNC = [[UINavigationController alloc] initWithRootViewController:userVC];
    userVC.tabBarItem.title = @"用户";
    userVC.tabBarItem.image = [UIImage imageNamed:@"tabbar_user_normal"];
    // 取消系统 tabBarItem 自带的蓝色
    userVC.tabBarItem.selectedImage = [[UIImage imageNamed:@"tabbar_user_highlighted"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    // 给 tabBarItem 文字设置颜色
    NSMutableDictionary *userTextDict = [NSMutableDictionary dictionary];
    userTextDict[NSForegroundColorAttributeName] = [UIColor orangeColor];
    [userVC.tabBarItem setTitleTextAttributes:userTextDict forState:UIControlStateSelected];
    
    self.viewControllers = @[homeNC, categoryNC, searchNC, userNC];
    
    
    
}



@end
